package com.whcoding.designpatterns.pattern.proxy;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-09-21 09:39
 **/
public class StaticProxyTests {

	public static void main(String[] args) {
		//创建目标对象 (被代理的对象)
		TeacherDaoImpl teacherDao=new TeacherDaoImpl();
		//创建代理对象 同时将被代理对象传递给代理对象
		TeacherDaoProxy teacherDaoProxy=new TeacherDaoProxy(teacherDao);
		//通过代理对象调用到被代理对象的方法（执行的是代理对象的方法，代理对象再去调用目标对象的方法）
		teacherDaoProxy.teach();
	}
}
